package com.huadi.bili_hot.controller;

import com.huadi.bili_hot.entity.Recommend;
import com.huadi.bili_hot.entity.Toprank;
import com.huadi.bili_hot.service.RecommendServiceImpl;
import com.huadi.bili_hot.service.ToprankService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
public class DetailController {
    @Autowired
    private RecommendServiceImpl recommendService;
    @Autowired
    private ToprankService toprankService;

    @RequestMapping("/detail")
    public String getDetail(ModelMap modelMap) {
        List<Recommend> bangumiRec = recommendService.getBangumiRec();
        List<Recommend> movieRec = recommendService.getMovieRec();
        List<Recommend> tvRec = recommendService.getTvRec();
        List<Toprank> hostRank = toprankService.getHostList();
        List<Toprank> bangumiRank = toprankService.getBangumiList();
        List<Toprank> movieRank = toprankService.getMovieList();
        List<Toprank> tvRank = toprankService.getTvseriesList();
        modelMap.put("bangumiRec", bangumiRec);
        modelMap.put("movieRec", movieRec);
        modelMap.put("tvRec", tvRec);
        modelMap.put("hostRank", hostRank);
        modelMap.put("bangumiRank", bangumiRank);
        modelMap.put("movieRank", movieRank);
        modelMap.put("tvRank", tvRank);
        return "detail";
    }
}
